import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/Index.vue'
import Top from '../views/Top.vue'
import MusicList from '../views/MusicList.vue'

Vue.use(VueRouter)
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
const routes = [
  {
    path: '/',
    name: 'Index',
    component: Index
  },
  {
    path: '/top',
    name: 'Top',
    component: Top
  },
  {
    path: '/musiclist',
    name: 'MusicList',
    component: MusicList
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
